import requests

session = requests.session()
cookie_header = {
    'content-length': '0',
    'accept': '*/*',
    'referer': 'https://match.yuanrenxue.com/match/3',
    'accept-encoding': 'gzip, deflate, br',
    'accept-language': 'zh-CN,zh;q=0.9',
    'cookie': 'no-alert3=true;sessionid=pwin2ge9j7t9ttj5m15pjwar9m4sj9tc;',
    'user-agent': 'yuanrenxue.project',
}


def get_data(page):
    session.headers.clear()
    session.headers.update(cookie_header)
    cookie_url = 'https://match.yuanrenxue.com/jssm'
    url = f'https://match.yuanrenxue.com/api/match/3?page={page}'
    res = session.post(cookie_url)
    print("cookies==>", res.cookies)
    return session.get(url).json()


def main():
    value_list = []
    for page in range(1, 6):
        res = get_data(page)
        value_list += [v['value'] for v in res['data']]
    print(value_list)
    print(max(value_list, key=value_list.count))


if __name__ == '__main__':
    main()
